<?php
 header("content-type:text/html;charset=utf-8");
 include_once('../public/index.php');
 $config = include_once('../../public/config/config.php');
 include_once('../../public/func/db.php');
 include_once('../../public/func/shangchuan.func.php');
 $table = 'user';
 $where = 'where id = '.$_GET['id'];
 $res = select($config,$table,$where);
 ?>
<script src="/admin/public/js/jquery-1.8.3.min.js"></script>
<script>
    $(function(){
        $('input').blur(function(){
            var n = $(this).attr('name');
            var v = $(this).attr('value');
            $.post('preg.php',{n:n,v:v},
                function(data){
                    switch(n){
                        case 'uname':
                            $('#void').empty().append(data);
                            break;
                        case 'email':
                            $('#void1').empty().append(data);
                            break;
                    };
                });
        });
    })
</script>
<div class="main-wrap">
    <div class="crumb-wrap">
        <div class="crumb-list"><i class="icon-font"></i><a href="/admin/index.php">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="/admin/user/user.php">用户管理</a><span class="crumb-step">&gt;</span><span>更改用户</span></div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="/admin/user/doupdateuser.php" method="post" id="myform" name="myform" enctype="multipart/form-data">
                    <table class="insert-tab" width="100%">
                        <tbody>
                            <tr>
                                <th><i class="require-red">*</i>昵称：</th>
                                <td>
                                    <input type="hidden" name="id" value="<?php echo $res['0']['id']?>">
                                    <input class="common-text required" name="nicname" size="50" type="text" value="<?php echo $res['0']['nicname']?>">
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>用户名：</th>
                                <td>
                                    <input class="common-text required" name="uname" size="50" type="text" 
                                    value="<?php echo $res['0']['uname']?>">
                                    <h5 style="color:red" id="void"></h5>
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>性别：</th>
                                <td>
                                    <input name="sex" type="radio" value="男">男
                                    <input name="sex" type="radio" value="女">女
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>邮箱：</th>
                                <td>
                                    <input class="common-text required" name="email" size="50" type="text" 
                                    value="<?php echo $res['0']['email']?>">
                                    <h5 style="color:red" id="void1"></h5>
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>头像：</th>
                                <td><input name="pic" type="file">
                                <input type="hidden" name="apic" value="<?php echo $res['0']['pic']?>">
                                <img width="80" src="/public/upload/<?php echo $res['0']['pic']?>"></td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>
                </form>
            </div>
        </div>
    </div>
</div>